package com.example.demo.controller;

import com.example.demo.Mappers.GetOrderListControllerMapper;
import com.example.demo.beans.GetOrderListControllerResponse;
import com.example.demo.beans.GetOrderListRequest;
import com.example.demo.beans.GetOrderListResponseitem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by Administrator on 2018-04-24.
 */
@RestController
public class GetOrderListController {
    @Autowired
    private GetOrderListControllerMapper mapper;

    @ResponseBody
    @RequestMapping(value = "GetOrderList",produces = {"application/xml"})
    public GetOrderListControllerResponse GetOrderlist(@RequestBody(required = false)GetOrderListRequest request){
        if(request!=null){
            List<GetOrderListResponseitem>items= mapper.selectOrderList(request.getPatientID(),request.getCardNo());
            GetOrderListControllerResponse r=new GetOrderListControllerResponse();
            r.setResultCode("0");
            r.setResultMsg("交易成功");
            r.setItems(items);
            return  r;
        }
        return  null;
    }
}
